Compilation: fix compiler_rt and ubsan_rt strategy logic#24866
Merged
Conversation
5e916b5 to
64fca4e
Compare
It doesn't really make sense for `target_util.canBuildLibCompilerRt` (and its ubsan-rt friend) to take in `use_llvm`, because the caller doesn't control that: they're just going to queue a sub-compilation for the runtime. The only exception to that is the ZCU strategy, where we effectively embed `_ = @import("compiler_rt")` into the Zig compilation: there, the question does matter. Rather than trying to do multiple weird calls to model this, just have `canBuildLibCompilerRt` return not just a boolean, but also differentiate the self-hosted backend being capable of building the library vs only LLVM being capable. Logic in `Compilation` uses that difference to decide whether to use the ZCU strategy, and also to disable the library if the compiler does not support LLVM and it is required. Also, remove a redundant check later on, when actually queuing jobs. We've already checked that we can build `compiler_rt`, and `compiler_rt_strat` is set accordingly. I'm guessing this was there to work around a bug I saw in the old strategy assignment, where support was ignored in some cases. Resolves: ziglang#24623
64fca4e to
fbe81bc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It doesn't really make sense for
target_util.canBuildLibCompilerRt(and its ubsan-rt friend) to take inuse_llvm, because the caller doesn't control that: they're just going to queue a sub-compilation for the runtime. The only exception to that is the ZCU strategy, where we effectively embed_ = @import("compiler_rt")into the Zig compilation: there, the question does matter. Rather than trying to do multiple weird calls to model this, just havecanBuildLibCompilerRtreturn not just a boolean, but also differentiate the self-hosted backend being capable of building the library vs only LLVM being capable. Logic inCompilationuses that difference to decide whether to use the ZCU strategy, and also to disable the library if the compiler does not support LLVM and it is required.Also, remove a redundant check later on, when actually queuing jobs. We've already checked that we can build
compiler_rt, andcompiler_rt_stratis set accordingly. I'm guessing this was there to work around a bug I saw in the old strategy assignment, where support was ignored in some cases.Resolves: #24623